// 懒加载路由
const Index = r => require.ensure([], () => r(require("@/views/index/index")), "basic")
const Role_List = r => require.ensure([], () => r(require("@/views/role/index")), "basic")
const Role_Detail = r => require.ensure([], () => r(require("@/views/role/detail")), "basic")
const User_List = r => require.ensure([], () => r(require("@/views/user/index")), "basic")
const User_Detail = r => require.ensure([], () => r(require("@/views/user/detail")), "basic")
const Group_List = r => require.ensure([], () => r(require("@/views/group/index")), "basic")
const Group_Detail = r => require.ensure([], () => r(require("@/views/group/detail")), "basic")
const Group_Assign = r => require.ensure([], () => r(require("@/views/group/assign/index")), "basic")
const Department_List = r => require.ensure([], () => r(require("@/views/department/index")), "basic")
const Department_Detail = r => require.ensure([], () => r(require("@/views/department/detail")), "basic")
const Organization_List = r => require.ensure([], () => r(require("@/views/organization/index")), "basic")
const Organization_Detail = r => require.ensure([], () => r(require("@/views/organization/detail")), "basic")
const DistType_List = r => require.ensure([], () => r(require("@/views/momo_dist/dist_type/index")), "basic")
const DistType_Detail = r => require.ensure([], () => r(require("@/views/momo_dist/dist_type/detail")), "basic")
const LoginLog_List = r => require.ensure([], () => r(require("@/views/login_log/index")), "basic")
const SystemLog_List = r => require.ensure([], () => r(require("@/views/system_log/index")), "basic")
const SystemLog_Detail = r => require.ensure([], () => r(require("@/views/system_log/detail")), "basic")
const ChangePassword = r => require.ensure([], () => r(require("@/views/mine/password")), "basic")
const Vform = r => require.ensure([], () => r(require("@/views/vform/index")), "basic")
const NotPerPage = r => require.ensure([], () => r(require("@/views/401")), "basic")
const ErrorPage = r => require.ensure([], () => r(require("@/views/404")), "basic")

// 必须引入该组件以支持二级子路由显示
const children = {template: '<router-view></router-view>'}

export default [
	{
		path: '/index',
		name: 'Index',
		component: Index,
		meta: {
			title: '主页',
			keepAlive: false, //是否需要缓存组件
			icon: 'el-icon-house',
			showToMenu: true, //是否展示在菜单上
			isTopMenu: true //是否顶级菜单
		}
	},
	{
		path: '/auth',
		name: 'Auth',
		component: children,
		meta: {
			title: '权限管理',
			icon: 'el-icon-user',
			showToMenu: true,
			isTopMenu: false,
			requireAdmin: true
		},
		children: [
			{
				path: '/role/list',
				name: 'Role_List',
				component: Role_List,
				meta: {
					title: '角色管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/role/detail',
				name: 'Role_Detail',
				component: Role_Detail,
				meta: {
					title: '角色详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/group/list',
				name: 'Group_List',
				component: Group_List,
				meta: {
					title: '群组管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/group/detail',
				name: 'Group_Detail',
				component: Group_Detail,
				meta: {
					title: '群组详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/group/assign',
				name: 'Group_Assign',
				component: Group_Assign,
				meta: {
					title: '分配群组',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/department/list',
				name: 'Department_List',
				component: Department_List,
				meta: {
					title: '部门管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/department/detail',
				name: 'Department_Detail',
				component: Department_Detail,
				meta: {
					title: '部门详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/organization/list',
				name: 'Organization_List',
				component: Organization_List,
				meta: {
					title: '组织管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/organization/detail',
				name: 'Organization_Detail',
				component: Organization_Detail,
				meta: {
					title: '组织详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/user/list',
				name: 'User_List',
				component: User_List,
				meta: {
					title: '用户管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/user/detail',
				name: 'User_Detail',
				component: User_Detail,
				meta: {
					title: '用户详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document',
				}
			}
		]
	},
	{
		path: '/monitor',
		name: 'Monitor',
		component: children,
		meta: {
			title: '系统监控',
			icon: 'el-icon-monitor',
			showToMenu: true,
			requireAdmin: true,
			links: true
		},
		children: [
			{
				path: 'http://localhost:9301/doc.html',
				meta: {
					title: '接口文档',
					showToMenu: true,
					icon: 'el-icon-document',
					className: 'un-active'
				}
			},
			{
				path: 'http://localhost:9302/login',
				meta: {
					title: '服务监控',
					showToMenu: true,
					icon: 'el-icon-document',
					className: 'un-active'
				}
			}
		]
	},
	{
		path: '/log',
		name: 'Log',
		component: children,
		meta: {
			title: '日志管理',
			icon: 'el-icon-date',
			showToMenu: true,
			isTopMenu: false,
			requireAdmin: true
		},
		children: [
			{
				path: '/login_log/list',
				name: 'LoginLog_List',
				component: LoginLog_List,
				meta: {
					title: '登录日志',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/system_log/list',
				name: 'SystemLog_List',
				component: SystemLog_List,
				meta: {
					title: '操作日志',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document',
				}
			},
			{
				path: '/system_log/detail',
				name: 'SystemLog_Detail',
				component: SystemLog_Detail,
				meta: {
					title: '日志详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document'
				}
			}
		]
	},
	{
		path: '/system',
		name: 'System',
		component: children,
		meta: {
			title: '系统管理',
			icon: 'el-icon-setting',
			showToMenu: true,
			isTopMenu: false,
			requireAdmin: true
		},
		children: [
			{
				path: '/dist/list',
				name: 'DistType_List',
				component: DistType_List,
				meta: {
					title: '字典管理',
					keepAlive: false,
					showToMenu: true,
					icon: 'el-icon-document'
				}
			},
			{
				path: '/dist/detail',
				name: 'DistType_Detail',
				component: DistType_Detail,
				meta: {
					title: '字典详情',
					keepAlive: false,
					showToMenu: false,
					icon: 'el-icon-document'
				}
			}
		]
	},
	{
		path: '/vform/index',
		name: 'Vform',
		component: Vform,
		meta: {
			title: '在线表单',
			keepAlive: false,
			showToMenu: true,
			isTopMenu: true,
			icon: 'el-icon-document'
		}
	},
	{
		path: '/mine/password',
		name: 'ChangePassword',
		component: ChangePassword,
		meta: {
			title: '修改密码',
			keepAlive: false,
			showToMenu: false,
			isTopMenu: true,
			icon: 'el-icon-document'
		}
	},
	{
		path: '/error',
		name: 'Error',
		component: children,
		meta: {
			title: '错误页面',
			icon: 'el-icon-warning-outline',
			showToMenu: false,
			isTopMenu: false
		},
		children: [
			{
				path: '/401',
				name: 'NotPerPage',
				component: NotPerPage,
				meta: {
					title: '401错误页面',
					keepAlive: false,
					icon: 'el-icon-circle-close'
				}
			},
			{
				path: '/404',
				name: 'ErrorPage',
				component: ErrorPage,
				meta: {
					title: '404错误页面',
					keepAlive: false,
					icon: 'el-icon-circle-close'
				}
			}
		]
	}
]

